const express = require('express');
const router = express.Router();
const RoleController = require('../controllers/role.controller');
const { authMiddleware } = require('../middlewares/auth.middleware');

// 创建角色
router.post('/', authMiddleware, RoleController.createRole);

// 获取角色列表
router.get('/', authMiddleware, RoleController.getRoles);

// 获取角色详情
router.get('/:id', authMiddleware, RoleController.getRoleById);

// 更新角色
router.put('/:id', authMiddleware, RoleController.updateRole);

// 删除角色
router.delete('/:id', authMiddleware, RoleController.deleteRole);

// 角色菜单分配
router.post('/:id/menus', authMiddleware, RoleController.assignMenus);

// 获取角色菜单
router.get('/:id/menus', authMiddleware, RoleController.getRoleMenus);

module.exports = router; 